<?php

/**
 * Description of comment
 *
 * @author Suraj
 */
class Form_Comment extends Zend_Form {
    function __construct($commentId) {
        parent::__construct();

        $name=$this->createElement("text", "Name");
        $name->addFilter('StringTrim')
             ->addFilter('StripTags')
             ->setRequired(true)
             ->addValidator('NotEmpty')
             ->setLabel("Name");

        $email=$this->createElement("text","Email");
        $email->addValidator('stringLength', false, array(4, 70))
                ->setRequired(false)
                ->addFilter('StringToLower')
                ->addFilter('StringTrim')
                 ->setLabel("Email")
                ->addFilter('StripTags');

        $webpage=$this->createElement("text","Webpage");
        $webpage->addValidator('stringLength', false, array(4, 200))
                ->setRequired(false)
                ->addFilter('StringToLower')
                ->addFilter('StringTrim')
                ->addFilter('StripTags')
                ->setValue("http://")
                ->setLabel("Web site");

        $description=$this->createElement("textarea","Description");
        $description->setRequired(true)
                ->addFilter('StringToLower')
                ->addFilter('StringTrim')
                ->setAttrib("rows", "10")
                ->setAttrib("cols", "30")
                ->addFilter('StripTags')
                ->setLabel("Comment");

        $hiddenPostId=$this->createElement("hidden","post_id");
        $hiddenId=$this->createElement("hidden","id")
                       ->setValue($commentId);

        $submit=$this->createElement("submit","Save");
        
        $this->addElements(array($name,$email,$webpage,$description,$hiddenPostId,$hiddenId,$submit));
        
    }
}
?>
